from django.urls import path
from django.contrib.auth import views as auth_views
from . import views
from . import college_views

app_name = 'accounts'

urlpatterns = [
    # 认证相关
    path('login/', auth_views.LoginView.as_view(
        template_name='registration/login.html',
        redirect_authenticated_user=True
    ), name='login'),
    path('logout/', auth_views.LogoutView.as_view(), name='logout'),
    
    # 用户管理 (仅管理员)
    path('users/', views.UserListView.as_view(), name='user_list'),
    path('users/create/', views.UserCreateView.as_view(), name='user_create'),
    path('users/<int:pk>/update/', views.UserUpdateView.as_view(), name='user_update'),
    path('users/<int:pk>/delete/', views.user_delete, name='user_delete'),
    
    # 个人信息
    path('profile/', views.profile_view, name='profile'),
    path('profile/edit/', views.profile_edit, name='profile_edit'),
    
    # 学院管理 (仅管理员)
    path('colleges/', college_views.college_list, name='college_list'),
    path('colleges/create/', college_views.college_create, name='college_create'),
    path('colleges/<int:pk>/', college_views.college_detail, name='college_detail'),
    path('colleges/<int:pk>/edit/', college_views.college_update, name='college_update'),
    path('colleges/<int:pk>/delete/', college_views.college_delete, name='college_delete'),
]
